

// 登陆用户头像昵称
var loginInfo = {}
showLoginInfo();

function showLoginInfo(){
	$.ajax({
		type : 'get',
		url : domainName + '/users/current',
		async : false,
		success : function(data) {
			loginInfo = data
		}
	});
}

function logout(){
	$.ajax({
		type : 'get',
		url : domainName + '/sys/logout',
		success : function(data) {
			localStorage.removeItem("access_token");
			localStorage.removeItem("refresh_token");
			location.href = loginPage;
		}
	});
}

function showLoading (loadText) {
	$.busyLoadFull("show", { spinner: "circle-line",animation: "fade", background: "rgba(0, 51, 101, 0.40)"});
}

function hideLoading() {
	$.busyLoadFull("hide");
}

Date.prototype.format = function (fmt) { //author: meizz
    var o = {
        "M+": this.getMonth() + 1, //月份
        "d+": this.getDate(), //日
        "h+": this.getHours(), //小时
        "m+": this.getMinutes(), //分
        "s+": this.getSeconds(), //秒
        "q+": Math.floor((this.getMonth() + 3) / 3), //季度
        "S": this.getMilliseconds() //毫秒
    };
    if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
    for (var k in o)
        if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
    return fmt;
}

var menuInfo = {}

var setCurMenu = null
function updateMenuInfo(parentMenu, menu) {
	var pathName = '',pathId = '', path = ''
	if(parentMenu.id == 0) {
		pathName = '首页 > ' + menu.name
		pathId = '0 > ' + menu.id
		
	} else {
		pathName = '首页 > ' + parentMenu.name + ' > ' + menu.name
		pathId = '0 > ' + parentMenu.id + ' > ' + menu.id
	}

	path = '/ > ' + menu.path

	menuInfo[menu['id']] = {
		pathName: pathName,
		pathId: pathId,
		path: path
	}
}

var active, selMenuId=-1;